import { Button } from 'antd';
import React, { useRef, useState } from 'react';

const { luckysheet } = window;

const ExportPdfBtn = () => {
  const [imgSrc, setImgSrc] = useState('');

  const onExport = () => {
    // const src = luckysheet.getScreenshot();
    // setImgSrc(src);
    const sheetData = luckysheet.getSheetData(); // 表数据
    console.log('sheetData', sheetData);

    // 生成html
    const html = luckysheet.getRangeHtml({ range: { row: [0, sheetData.length], column: [0, 8] } });

    // console.log(html, '>>>');
    // setHtmlStr(html);
  };

  return (
    <div>
      <Button onClick={onExport}>生成PDF</Button>
      <img src={imgSrc} />
    </div>
  );
};

export default ExportPdfBtn;
